package cn.com.chengmandian.bike.controller;


import cn.com.chengmandian.bike.model.EbRechargeActivity;
import cn.com.chengmandian.bike.service.IEbRechargeActivityService;
import cn.com.chengmandian.core.web.pojo.AjaxResult;
import cn.com.chengmandian.core.web.utils.LocalMapUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 电单车运营-充值送礼活动 前端控制器
 * </p>
 *
 * @author AutoGenerator
 * @since 2022-02-28
 */
@Api(tags = "充值送礼活动相关接口")
@RestController
@RequestMapping("/recharge/activity")
public class EbRechargeActivityController {
    @Autowired
    private IEbRechargeActivityService rechargeActivityService;

    @ApiOperation("可用活动列表")
    @GetMapping("/list")
    public AjaxResult<List<EbRechargeActivity>> list() {
        Integer areaId = LocalMapUtil.getAgentInfo().getAreaId();
        Assert.notNull(areaId, "缺少运营区");
        return AjaxResult.success(rechargeActivityService.getList(areaId));
    }
}
